<template>
	<view class="kefang_out">
		<!-- <view class="top_box">
			<view class="addbtn"><u-button color="#535353" @click="show_add()" class="custom-style" text="添加日志"></u-button></view>
		</view> -->
		<view class="searchbox" style="margin: 15rpx 0;">
			<u-search :showAction="false" @click="getlist()" @change="getlist()" @search="getlist()"  placeholder="输入账号名称搜索" v-model="key"></u-search>
		</view>

		<view class="table_box">
			<uni-table border stripe emptyText="暂无更多数据">
				
				<!-- 表头行 -->
				<uni-tr>
					<uni-th width="40" align="center">店员账号</uni-th>
					<uni-th width="40" align="center">名称</uni-th>
					<uni-th width="80" align="left">电话</uni-th>
					<uni-th width="80" align="left">操作</uni-th>
				</uni-tr>
				<!-- 表格数据行 -->
				<uni-tr v-for="(item, index) in list" :key="index">
					<uni-td >
					 {{item.account}}
					
					</uni-td>
					<uni-td >
					 {{item.supername}}
					
					
					</uni-td>
					
					<uni-td >
					 {{item.tel}}
					
					</uni-td>
					
					<uni-td>
						<u-button @click="del(item)"  style="width: 120rpx;margin: 10rpx 0;" size="mini" 
						type="error" text="注销"></u-button>
						<u-button @click="show_detail(item)"  style="width: 120rpx;margin: 10rpx 0;" size="mini"
						text="用户详情"></u-button>
						<!-- <u-button style="width: 120rpx; margin: 10rpx 0;"  size="mini" type="error" text="删除房间"></u-button> -->
					</uni-td>
				</uni-tr>
			</uni-table>
		
		
		</view>
		
		
		<u-popup round="10" closeable mode="center" :show="poup_show" @close="close" >
			<view class="popup_box">
				<view class="tit">用户详情</view>
				<!-- account: '',
				day_nums: '',
				reasons: '' -->
				<view class="contnet_box">
					<view class="txt_item">
						用户名:{{detail.supername}}
					</view>
					<u-line></u-line>
					<view class="txt_item">
						账号:{{detail.account}}
					</view>
					<u-line></u-line>
					
					<view class="txt_item">
						性别:{{detail.sex}}
					</view>
					<u-line></u-line>
					
					<view class="txt_item">
						邮箱:{{detail.email}}
					</view>
					<u-line></u-line>
					
					<view class="txt_item">
						地址:{{detail.address}}
					</view>
					<u-line></u-line>
					
					<view class="txt_item">
						电话:{{detail.tel}}
					</view>
					
					<u-line></u-line>
					
				</view>
				
				
			</view>
		</u-popup>
		
	</view>
</template>

<script>
import { Request2 } from '@/until/api.js';
export default {
	data() {
		return {
			list: [],
			detail:{},
			key:"",
			addForm: {
				works: '',
				key:"",
			},
			poup_show: false,
		};
	},
	onShow() {
		this.getlist();
	},
	methods: {
		show_detail(item){
			this.detail=item;
			this.poup_show = true;
		},
		// 退房
		async del(item){
			var requsetdata={
				...item
				
				
			}
			var res = await Request2('/super/del', 'post', requsetdata);
			if(res.data.code=="200"){
				
			
				this.$u.toast("删除成功!");
				this.getlist()
			}else{
				this.$u.toast(res.data.msg);
			}
		},
		close(){
			this.poup_show=false;
		},
		
		//获取列表
		async getlist() {
			var requsetdata = {
				pageNum: 1,
				pageSize: 999,
				user_type:2,
				key:this.key,
				account:uni.getStorageSync('account'),
				
			};
			var res = await Request2('/super/list', 'post', requsetdata);
			this.list = res.data.data;
			console.log(this.list, 'this.list');
		}
	}
};
</script>

<style lang="scss" scoped>
.top_box {
	margin: 20rpx;
	.addbtn {
		width: 150rpx;
		height: 80rpx;
	}
}
.popup_box {
	// background-color: #fff;
	width: 600upx;
	min-height: 480upx;

	overflow: hidden;

	box-sizing: border-box;
	// padding: 0 0upx;
	.contnet_box {
		padding: 20upx 20upx;
		.txt_item{
			padding: 10rpx 0;
		}
		.item_input {
			display: flex;
			width: 100%;
			// text-align: center;

			margin: 15upx 0;
			.label {
				line-height: 60upx;
			}
		}
	}

	.tit {
		text-align: center;
		margin-top: 40upx;
		font-size: 38upx;
		font-weight: 500;
	}
	.tips {
		margin: 60upx 0;
		color: #c2c2c2;
		font-size: 34upx;
		letter-spacing: 2upx;
	}
	.code {
		padding: 0;
		padding-left: 15upx;
	}
}

</style>
